<template>
  <div class="mains">
    <div style="min-height: 915px; padding: 100px 0 0 600px">
    </div>
  </div>

</template>

<script>

import { setToken } from '@/utils/auth'
export default {
  name: 'Loginwait',
  data() {
    return {
      count: ''
    }
  },
  created() {
    this.goGrdoupRecor();
  },
  methods: {
    //  2秒后进入首页
    goGrdoupRecor() {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      const TIME_COUNT = 2;
      if (!this.timer) {
        this.count = TIME_COUNT;
        this.show = false;
        this.timer = setInterval(() => {
          loading.close();
          if (this.count > 0 && this.count <= TIME_COUNT) {
            this.count--;
          } else {
            this.show = true;
            clearInterval(this.timer);
            this.timer = null;
            //跳转的页面写在此处
            if (this.$route.query.token) {
              setToken(this.$route.query.token)
              this.$router.push({
                path: this.redirect || "/",
              })
              this.$message({
                message: "微信登录成功!",
                type: "success",
              });
            }
          }
        }, 1500)
      }
    }
  }
}
</script>

<style scoped>
.mains {
  background: url(~@/assets/login3.jpg);
  /* background: url(~@/assets/login2.jpg); */
  /* background: url(../../../public/login.jpg); */
  background-size: 100% 100%;
  position: relative;
  opacity: .9;
}
</style>